import 'package:shared_preferences/shared_preferences.dart';

class CacheUtil {
  static saveToken(String s) async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    await prefs.setString("token", s);
  }

  static Future<String> getToken() async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    return prefs.getString("token") ?? "";
  }

  static Future<void> saveCurrentUrl(String base_url) async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    await prefs.setString("baseUrl", base_url);
  }

  static Future<String?> getCurrentUrl() async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    return await prefs.getString("baseUrl");
  }
}
